package com.wanaofu.model;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

import org.hibernate.annotations.ForeignKey;

@Entity
@Table(name = "wh_bal",uniqueConstraints ={@UniqueConstraint(columnNames={"wh_id","prod_id","bat_no"})})
public class WarehouseBalance extends AbstractBaseEntity implements Serializable{
	private static final long serialVersionUID = -4065377265440069734L;
    public WarehouseBalance(){}
    
    public WarehouseBalance(Warehouse position,ProductInfo product,String batchNo,Integer balanceAmout){
    	this.position = position ;
    	this.product = product ;
    	this.batchNo = batchNo ;
    	this.balanceAmout = balanceAmout ;
    }
    
	@ManyToOne(cascade = CascadeType.ALL)
	@ForeignKey(name="FK_BAL_POS_ID")
	@JoinColumn(name="WH_ID")
    private Warehouse position ;

	@ManyToOne(cascade = CascadeType.ALL)
	@ForeignKey(name="FK_BAL_PROD_ID")
	@JoinColumn(name="PROD_ID")
    private ProductInfo product ;
	
	@Column(name = "BAT_NO", nullable=false, length=20 )
	private String batchNo;
	
	@Column(name = "BAL_AMT", nullable=false )
	private Integer balanceAmout = 0;
	public Warehouse getPosition() {
		return position;
	}

	public void setPosition(Warehouse position) {
		this.position = position;
	}

	public ProductInfo getProduct() {
		return product;
	}

	public void setProduct(ProductInfo product) {
		this.product = product;
	}

	public String getBatchNo() {
		return batchNo;
	}

	public void setBatchNo(String batchNo) {
		this.batchNo = batchNo;
	}

	public Integer getBalanceAmout() {
		return balanceAmout;
	}

	public void setBalanceAmout(Integer balanceAmout) {
		this.balanceAmout = balanceAmout;
	}

	@Override
	boolean businessEquals(Object p) {
		// TODO Auto-generated method stub
		return false;
	}
	
}
